This repository was archived by the owner on Nov 9, 2025. It is now read-only.
Add both variants of half open range patterns to the grammar#37
Merged
bors[bot] merged 2 commits intorust-analyzer:masterfrom Aug 13, 2021
Merged
Add both variants of half open range patterns to the grammar#37bors[bot] merged 2 commits intorust-analyzer:masterfrom
bors[bot] merged 2 commits intorust-analyzer:masterfrom
Conversation
matklad
reviewed
Aug 4, 2021
| // 1..2 | ||
| | start:Pat op:('..' | '..=') end:Pat | ||
| // ..2 | ||
| | op:('..' | '..=') end:Pat |
Contributor
There was a problem hiding this comment.
Let's fold this into the same case, like we did for RangeExpr
Contributor
Author
There was a problem hiding this comment.
These are slightly semantically different: what I wrote here is 1..2 or 1.. or ..2 but not ... rustc will syntax error if you put .., although it will tell you what you did wrong:
error: `..` patterns are not allowed here
--> src/main.rs:3:9
|
3 | .. => 4,
| ^^
|
= note: only allowed in tuple, tuple struct, and slice patterns
Contributor
|
could you also bump version in Cargo.toml to get this released? |
This is prompted by rust-lang/rust-analyzer#9779, but it is not actually a prerequisite of making that one happen as this commit doesn't change the generated code on the r-a side.
Contributor
Author
|
bors r+ |
Contributor
|
Build succeeded: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is prompted by
rust-lang/rust-analyzer#9779, but it
is not actually a prerequisite of making that one happen as this commit
doesn't change the generated code on the r-a side.
Relevant PR (that does not require this one be merged immediately/a release made): rust-lang/rust-analyzer#9780